package com.example.leetcode.tree;

import com.example.leetcode.tree.common.TreeNode;
import com.example.leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode() {}
 * TreeNode(int val) { this.val = val; }
 * TreeNode(int val, TreeNode left, TreeNode right) {
 * this.val = val;
 * this.left = left;
 * this.right = right;
 * }
 * }
 */
class Solution671 {
    public int findSecondMinimumValue(TreeNode root) {
        return TreeUtils.findSecondMinimumValue(root);
    }
}

public class leetcode671 {
    public static void main(String[] args) {
        Solution671 solution671 = new Solution671();
        Integer[] nums = {2, 2, 5, null, null, 5, 7};
        Integer[] nums1 = {1, 1, 3, 1, 1, 3, 4, 3, 1, 1, 1, 3, 8, 4, 8, 3, 3, 1, 6, 2, 1};
        System.out.println(solution671.findSecondMinimumValue(TreeUtils.generateLeetcodeTree(nums)));
        System.out.println(solution671.findSecondMinimumValue(TreeUtils.generateLeetcodeTree(nums1)));
    }
}
